package net.discard.model;

import com.alibaba.fastjson.JSONObject;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.sub_erupt.Power;
import xyz.erupt.upms.model.base.HyperModel;

import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;

/**
 * @Author: Discard
 * @Date: 2021/2/20 2:55 下午
 */
@Erupt(name = "伙伴",
        power = @Power(importable = true, export = true),
        orderBy = "id desc"
)
@Entity
@Table(name = "partner")
public class Partner extends HyperModel {

    public long userId;

    public String name;

    public String idCard;

    public int sex;

    public int relation;

    public Date birthday;

    @CreatedDate
    public Date createTime;

    @LastModifiedDate
    public Date updateTime;

    public Partner(){

    }

    public Partner(JSONObject para) {
        this.userId = para.getInteger("userId");
        this.name = para.getString("name");
        this.idCard = para.getString("idCard");
        this.sex = para.getInteger("sex");
        this.relation = para.getInteger("relation");
        this.birthday = para.getDate("birthday");
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        this.userId = userId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getRelation() {
        return relation;
    }

    public void setRelation(int relation) {
        this.relation = relation;
    }

    public String getIdCard() {
        return idCard;
    }

    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    public int getSex() {
        return sex;
    }

    public void setSex(int sex) {
        this.sex = sex;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    @Override
    public Date getCreateTime() {
        return createTime;
    }

    @Override
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Override
    public Date getUpdateTime() {
        return updateTime;
    }

    @Override
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}
